{extend name="layout/layout" /}

{block name="pagecss"}
<style>
    .cover-image img {
        width: 100px;
        height: 100px;
        cursor: pointer;
        border: 1px solid #ccc;
    }
    .cover-image img.del {
        width: 24px;
        height: 24px;
        margin-top: -97px;
        margin-left: -16px;
        cursor: pointer;
        border: 0;
    }

    .uploader-div {
        border: solid 1px #ccc;
        width: 100px;
        height: 100px;
        display: flex;
        justify-content: center;
        align-items: center;
        flex-direction: column;
        cursor: pointer;
    }

    .uploader-div .icon {
        font-size: 40px;
        color: #999999;
    }
</style>
{/block}

{block name="content"}
<div class="row">
    <div class="col-md-12">
        <div class="portlet light">
            <div class="portlet-title">
                <div class="caption">
                    <i class="icon-share font-dark"></i>
                    <span class="caption-subject font-dark bold uppercase"> 添加</span>
                </div>
                <div class="actions">
                    <a class="btn btn-circle btn-icon-only btn-default fullscreen" href="javascript:;" data-original-title="" title=""> </a>
                </div>
            </div>
            <div class="portlet-body">
                <form class="form-horizontal form" id="povertywork_form" action="{:url('admin/'.strtolower($model).'/addpost')}" method="post" id="add_new">
                    <div class="form-body">
                        <div class="row" style="margin-bottom: 10px;">
                            <div class="col-md-9">
                                <div class="form-inline">
                                    <label class="control-label col-md-3">
                                        选择乡村
                                        <span class="required">*</span>
                                    </label>
                                    <div class="col-md-9">
                                        {include file="common:selectarea" /}
                                    </div>
                                </div>
                            </div>
                        </div>
                        <div class="row">
                            <div class="col-md-9">
                                <div class="form-group">
                                    <label class="control-label col-md-3">
                                        贫困户<span class="required">*</span>
                                    </label>
                                    <div class="col-md-9">
                                        <button class="add-btn form-control" type="button"  data-title="添加成员"></button>
                                        <input type="hidden" id="objid" name="povertymemberId" value="">
                                    </div>
                                </div>
                            </div>
                        </div>
                        <div class="row">
                            <div class="col-md-9">
                                <div class="form-group">
                                    <label class="control-label col-md-3">
                                        扶贫工作描述<span class="required">*</span>
                                    </label>
                                    <div class="col-md-9">
                                        <textarea class="form-control" id="note" onkeyup="this.value=this.value.substring(0,800)" data-required="1" maxlength="800"  rows="5" cols="20" name="content"></textarea><span id="text-count" value="">0</span>/800
                                    </div>
                                </div>
                            </div>
                        </div>
                        <div class="row">
                            <div class="col-md-9">
                                <div class="form-group">
                                    <label class="control-label col-md-3">
                                        图片
                                    </label>
                                    <div class="col-md-9">
                                        <div id="upload-image" class="cover-imag">
                                            <span id="upload-btn" data-multi="true" data-ajax="true" data-field="imgUrl" data-total="9" >
                                                <img src="__STATIC__/admin/img/default.png" alt="图片上传" style="width: 100px;height: 100px;" />
                                            </span>
                                        </div>
                                        <span>(最多上传9张)</span>
                                    </div>
                                </div>
                            </div>
                        </div>

                        <div class="form-actions">
                            <div class="row">
                                <div class="col-md-12">
                                    <div class="form-group">
                                        <label class="col-md-3 control-label"></label>
                                        <div class="col-md-9">
                                            <button type="button" id="form-submit" class="btn btn-primary">
                                                保存 <i class="fa fa-floppy-o"></i>
                                            </button>
                                            <button type="button" class="btn btn-default" onclick="history.go(-1);">
                                                返回 <i class="fa fa-mail-forward"></i>
                                            </button>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </form>
            </div>
        </div>
    </div>
</div>
<input type="hidden" class="token_url" value="{:url('admin/Image/token')}">
<input type="hidden" class="record_url" value="{:url('admin/Image/record')}">
<input type="hidden" class="delimage_url" value="{:url('admin/Image/delete')}">
{/block}

{block name="pagescript"}
<script src="__STATIC__/plugins/datatables/datatables.min.js" type="text/javascript"></script>
<script type="text/javascript">

    var posturl = "{:url('admin/'.strtolower($model).'/addpost')}";
    var povertymember = "{:url('admin/layer/povertymember')}";
    var povertyparty = "{:url('admin/layer/povertyparty')}";
    var total = 9;
    var imgcount = 0;
    
</script>
<script src="__STATIC__/admin/js/qiniu/plupload.full.min.js" type="text/javascript"></script>
<script src="__STATIC__/admin/js/qiniu/qiniu.js" type="text/javascript"></script>
<script src="__STATIC__/admin/js/qiniu/qiniuConfig.js" type="text/javascript"></script>
<script src="__STATIC__/admin/pages/js/povertywork.js" type="text/javascript"></script>
<script src="__STATIC__/admin/pages/js/uploadfile.js" type="text/javascript"></script>
{/block}